<?php

namespace app\api\model;

use app\common\model\Base;

class UserData extends Base {

    // 追加属性
    protected $append = ['preview_avatar_url'];

    public function getPreviewAvatarUrlAttr($value,$data)
    {
        if(empty($data['avatar'])){
            return '';
        }
        $filesystemConfig = config('filesystem.disks.public');
        return request()->domain().$filesystemConfig['url'].$data['avatar'];
    }
}
